/**
 */
package fr.lip6.move.care.sdmaker.sDMaker.impl;

import fr.lip6.move.care.sdmaker.sDMaker.Alt;
import fr.lip6.move.care.sdmaker.sDMaker.CombinableElement;
import fr.lip6.move.care.sdmaker.sDMaker.SDMakerPackage;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Alt</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link fr.lip6.move.care.sdmaker.sDMaker.impl.AltImpl#getConseq <em>Conseq</em>}</li>
 *   <li>{@link fr.lip6.move.care.sdmaker.sDMaker.impl.AltImpl#getAlter <em>Alter</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class AltImpl extends CombinedFragmentImpl implements Alt
{
  /**
   * The cached value of the '{@link #getConseq() <em>Conseq</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getConseq()
   * @generated
   * @ordered
   */
  protected EList<CombinableElement> conseq;

  /**
   * The cached value of the '{@link #getAlter() <em>Alter</em>}' containment reference list.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getAlter()
   * @generated
   * @ordered
   */
  protected EList<CombinableElement> alter;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected AltImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return SDMakerPackage.Literals.ALT;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<CombinableElement> getConseq()
  {
    if (conseq == null)
    {
      conseq = new EObjectContainmentEList<CombinableElement>(CombinableElement.class, this, SDMakerPackage.ALT__CONSEQ);
    }
    return conseq;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EList<CombinableElement> getAlter()
  {
    if (alter == null)
    {
      alter = new EObjectContainmentEList<CombinableElement>(CombinableElement.class, this, SDMakerPackage.ALT__ALTER);
    }
    return alter;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case SDMakerPackage.ALT__CONSEQ:
        return ((InternalEList<?>)getConseq()).basicRemove(otherEnd, msgs);
      case SDMakerPackage.ALT__ALTER:
        return ((InternalEList<?>)getAlter()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case SDMakerPackage.ALT__CONSEQ:
        return getConseq();
      case SDMakerPackage.ALT__ALTER:
        return getAlter();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case SDMakerPackage.ALT__CONSEQ:
        getConseq().clear();
        getConseq().addAll((Collection<? extends CombinableElement>)newValue);
        return;
      case SDMakerPackage.ALT__ALTER:
        getAlter().clear();
        getAlter().addAll((Collection<? extends CombinableElement>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case SDMakerPackage.ALT__CONSEQ:
        getConseq().clear();
        return;
      case SDMakerPackage.ALT__ALTER:
        getAlter().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case SDMakerPackage.ALT__CONSEQ:
        return conseq != null && !conseq.isEmpty();
      case SDMakerPackage.ALT__ALTER:
        return alter != null && !alter.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //AltImpl
